/*
 * peg.cpp
 *
 *  Created on: 10 déc. 2011
 *      Author: Elca
 */
#include "def.hpp"
#include "BoardInfos.hpp"
#include "File.h"
#include "HazardQueue.h"
#include "Solver.hpp"
#include <iostream>
#include <ctime>
#include <omp.h>
//#include <atomic>
using namespace std;
using namespace pcm;

//Level 4
//Number solutions: 0
//Number solutions: 14
//Number solutions: 14
//Number solutions: 14
//Number solutions: 0
//Number solutions: 14
//Number solutions: 0
//Number solutions: 14
//Number solutions: 14
//Number solutions: 0
//Level 5
//Number solutions: 29760
//Number solutions: 14880
//Number solutions: 14880
//Number solutions: 85258
//Number solutions: 1550
//Number solutions: 85258
//Number solutions: 14880
//Number solutions: 1550
//Number solutions: 1550
//Number solutions: 14880
//Number solutions: 29760
//Number solutions: 14880
//Number solutions: 85258
//Number solutions: 14880
//Number solutions: 29760
//Level 6
//Number solutions: 43419942138
//Number solutions: 82905434589
//Number solutions: 82905434589
//Number solutions: 113077359159
//Number solutions: 29235690234
//Number solutions: 113077359159
//Number solutions: 113077359159
//Number solutions: 266871356732
//Number solutions: 266871356732
//Number solutions: 113077359159
//Number solutions: 82905434589
//Number solutions: 29235690234
//Number solutions: 266871356732
//Number solutions: 29235690234
//Number solutions: 82905434589
//Number solutions: 43419942138
//Number solutions: 82905434589
//Number solutions: 113077359159
//Number solutions: 113077359159
//Number solutions: 82905434589
//Number solutions: 43419942138
//Level 7
//Number solutions: 0
//Number solutions: 422164782932465380
//Number solutions: 422164782932465380

#include "Hash.hpp"
int main(int argc, char* argv[]){

	cout << sizeof(LL)<<endl;

	BoardInfos board1;
	board1.updateGameInfos(4);
	BoardInfos board2;
	board2.updateGameInfos(4);
	BoardInfos board3;
	board3.updateGameInfos(4);
	BoardInfos board4;
	board4.updateGameInfos(4);

	BoardInfos board5;
	board5.updateGameInfos(4);

	board1.initBoard(0);
	board2.initBoard(1);
	board3.initBoard(3);
	board4.initBoard(4);
	board5.initBoard(7);

	Hash hash;

	cout<< hash.add(&board1)<<endl;
	cout<< hash.add(&board2)<<endl;
	cout<< hash.add(&board3)<<endl;
	cout<< hash.add(&board4)<<endl;
	cout<< hash.add(&board5)<<endl;

	cout<< "Count:"<<hash.m_itemCount<<endl;
	cout<< "Size:"<<hash.m_size<<endl;
	HashNode* cur = hash.m_primaryBuckets[0][0];
	while(true){
		if(cur==NULL){
			break;
		}else
		if(cur->m_sentinel){
			cout <<"Sentinel: "<<cur->m_reversedKey<<endl;

		}else{
			cout <<"Item: rkey:"<<cur->m_reversedKey<<" key:"<<cur->m_item->board()<<endl;
			//cur->m_item->printBoard();
		}
		cur = cur->m_next;
	}

	BoardInfos* v =hash.getItem(board1.board()+1);
	v->printBoard();
	cout<< hash.remove(&board5)<<endl;
	cout<< hash.remove(&board1)<<endl;
	cout<< hash.remove(&board2)<<endl;
	cout<< hash.remove(&board3)<<endl;
	cout<< hash.remove(&board4)<<endl;


	return 0;
}

